import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:xiongan_app_yy/pages/common/TextFieldItem.dart';
import 'package:xiongan_app_yy/utils/md5_utils.dart';
import 'package:xiongan_app_yy/utils/sp_utils.dart';
import 'package:xiongan_app_yy/utils/toast_utils.dart';
import 'package:xiongan_app_yy/widgets/comm/left_icon_widget.dart';

//修改密码
class ChangePasswordPage extends StatefulWidget{

  @override
  State<StatefulWidget> createState() {
    return ChangePasswordPageState();
  }
}

class ChangePasswordPageState extends State<ChangePasswordPage> {
  String PASSWORD = "password";
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: new AppBar(
        backgroundColor: Color(0XFF00A5F1),
        automaticallyImplyLeading: false, //设置没有返回按钮
        title: Text(
          "修改密码",
          style: TextStyle(fontSize: 18),
        ),
        elevation: 0,
        centerTitle: true,
        leading: LeftIconWidget(icon: Icons.chevron_left, isize: 36),
      ),
      body: Container(
        width: double.infinity,
        margin: EdgeInsets.only(top: 135),
        child: Column(
        children: <Widget>[
          Text("输入原密码",style: TextStyle(fontSize: 16)),
          TextFieldItem(
            hintText: "输入原密码:",
            scan: false,
            mLine: 1 ,
            onSubmitted: (text){
              if(text==SpUtil.preferences.getString(PASSWORD)){
                 Navigator.popAndPushNamed(context, "/password_submission_page");
              }else{
                TostUtil.showToast("密码错误");
              }
            },
            isPassWord: true,
            inputFormatters: [
              LengthLimitingTextInputFormatter(16),
            ],
            TextSize: 18,
            bgColor: Color(0xffDFD9D8),
            mar: EdgeInsets.only(left: 30,right: 30,top: 10),
            contentPad: EdgeInsets.all(10),
          )
        ],
      ),)

    );
  }

}